home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_6 / PROCESSO.{14 < prev    next >
Text File  |  1999-09-17  |  5KB  |  175 lines

  1. /* $Id: processor.h,v 1.70 1999/03/24 11:42:44 davem Exp $
  2.  * include/asm-sparc/processor.h
  3.  *
  4.  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
  5.  */
  6.  
  7. #ifndef __ASM_SPARC_PROCESSOR_H
  8. #define __ASM_SPARC_PROCESSOR_H
  9.  
  10. #include <linux/a.out.h>
  11.  
  12. #include <asm/psr.h>
  13. #include <asm/ptrace.h>
  14. #include <asm/head.h>
  15. #include <asm/signal.h>
  16. #include <asm/segment.h>
  17. #include <asm/btfixup.h>
  18. #include <asm/page.h>
  19.  
  20. /*
  21.  * Bus types
  22.  */
  23. #define EISA_bus 0
  24. #define EISA_bus__is_a_macro /* for versions in ksyms.c */
  25. #define MCA_bus 0
  26. #define MCA_bus__is_a_macro /* for versions in ksyms.c */
  27.  
  28. /*
  29.  * The sparc has no problems with write protection
  30.  */
  31. #define wp_works_ok 1
  32. #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
  33.  
  34. /* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too... 
  35.  * That one page is used to protect kernel from intruders, so that
  36.  * we can make our access_ok test faster
  37.  */
  38. #define TASK_SIZE    PAGE_OFFSET
  39.  
  40. struct fpq {
  41.     unsigned long *insn_addr;
  42.     unsigned long insn;
  43. };
  44.  
  45. typedef struct {
  46.     int seg;
  47. } mm_segment_t;
  48.  
  49. /* The Sparc processor specific thread struct. */
  50. struct thread_struct {
  51.     unsigned long uwinmask __attribute__ ((aligned (8)));
  52.     struct pt_regs *kregs;
  53.  
  54.     /* For signal handling */
  55.     unsigned long sig_address __attribute__ ((aligned (8)));
  56.     unsigned long sig_desc;
  57.  
  58.     /* Context switch saved kernel state. */
  59.     unsigned long ksp __attribute__ ((aligned (8)));
  60.     unsigned long kpc;
  61.     unsigned long kpsr;
  62.     unsigned long kwim;
  63.  
  64.     /* Special child fork kpsr/kwim values. */
  65.     unsigned long fork_kpsr __attribute__ ((aligned (8)));
  66.     unsigned long fork_kwim;
  67.  
  68.     /* A place to store user windows and stack pointers
  69.      * when the stack needs inspection.
  70.      */
  71. #define NSWINS 8
  72.     struct reg_window reg_window[NSWINS] __attribute__ ((aligned (8)));
  73.     unsigned long rwbuf_stkptrs[NSWINS] __attribute__ ((aligned (8)));
  74.     unsigned long w_saved;
  75.  
  76.     /* Floating point regs */
  77.     unsigned long   float_regs[32] __attribute__ ((aligned (8)));
  78.     unsigned long   fsr;
  79.     unsigned long   fpqdepth;
  80.     struct fpq    fpqueue[16];
  81.     unsigned long flags;
  82.     mm_segment_t current_ds;
  83.     struct exec core_exec;     /* just what it says. */
  84.     int new_signal;
  85. };
  86.  
  87. #define SPARC_FLAG_KTHREAD      0x1    /* task is a kernel thread */
  88. #define SPARC_FLAG_UNALIGNED    0x2    /* is allowed to do unaligned accesses */
  89.  
  90. #define INIT_MMAP { &init_mm, (0), (0), \
  91.             NULL, __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
  92.  
  93. #define INIT_TSS  { \
  94. /* uwinmask, kregs, sig_address, sig_desc, ksp, kpc, kpsr, kwim */ \
  95.    0,        0,     0,           0,        0,   0,   0,    0, \
  96. /* fork_kpsr, fork_kwim */ \
  97.    0,         0, \
  98. /* reg_window */  \
  99. { { { 0, }, { 0, } }, }, \
  100. /* rwbuf_stkptrs */  \
  101. { 0, 0, 0, 0, 0, 0, 0, 0, }, \
  102. /* w_saved */ \
  103.    0, \
  104. /* FPU regs */   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  105.                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
  106. /* FPU status, FPU qdepth, FPU queue */ \
  107.    0,          0,  { { 0, 0, }, }, \
  108. /* flags,              current_ds, */ \
  109.    SPARC_FLAG_KTHREAD, KERNEL_DS, \
  110. /* core_exec */ \
  111. { 0, }, \
  112. /* new_signal */ \
  113.   0, \
  114. }
  115.  
  116. /* Return saved PC of a blocked thread. */
  117. extern __inline__ unsigned long thread_saved_pc(struct thread_struct *t)
  118. {
  119.     return t->kpc;
  120. }
  121.  
  122. /* Do necessary setup to start up a newly executed thread. */
  123. extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc,
  124.                     unsigned long sp)
  125. {
  126.     register unsigned long zero asm("g1");
  127.  
  128.     regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
  129.     regs->pc = ((pc & (~3)) - 4);
  130.     regs->npc = regs->pc + 4;
  131.     regs->y = 0;
  132.     zero = 0;
  133.     __asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
  134.                  "std\t%%g0, [%0 + %3 + 0x08]\n\t"
  135.                  "std\t%%g0, [%0 + %3 + 0x10]\n\t"
  136.                  "std\t%%g0, [%0 + %3 + 0x18]\n\t"
  137.                  "std\t%%g0, [%0 + %3 + 0x20]\n\t"
  138.                  "std\t%%g0, [%0 + %3 + 0x28]\n\t"
  139.                  "std\t%%g0, [%0 + %3 + 0x30]\n\t"
  140.                  "st\t%1, [%0 + %3 + 0x38]\n\t"
  141.                  "st\t%%g0, [%0 + %3 + 0x3c]"
  142.                  : : "r" (regs), "r" (sp - REGWIN_SZ), "r" (zero),
  143.                  "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])));
  144. }
  145.  
  146. /* Free all resources held by a thread. */
  147. #define release_thread(tsk)        do { } while(0)
  148. extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  149.  
  150.  
  151. #define copy_segments(__nr, __tsk, __mm)    \
  152.     if((__tsk) == current &&        \
  153.        (__mm) != NULL)            \
  154.         flush_user_windows()
  155. #define release_segments(mm)        do { } while (0)
  156. #define forget_segments()        do { } while (0)
  157.  
  158. #ifdef __KERNEL__
  159.  
  160. extern struct task_struct *last_task_used_math;
  161.  
  162. /* Allocation and freeing of basic task resources. */
  163. BTFIXUPDEF_CALL(struct task_struct *, alloc_task_struct, void)
  164. BTFIXUPDEF_CALL(void, free_task_struct, struct task_struct *)
  165.  
  166. #define alloc_task_struct() BTFIXUP_CALL(alloc_task_struct)()
  167. #define free_task_struct(tsk) BTFIXUP_CALL(free_task_struct)(tsk)
  168.  
  169. #define init_task    (init_task_union.task)
  170. #define init_stack    (init_task_union.stack)
  171.  
  172. #endif
  173.  
  174. #endif /* __ASM_SPARC_PROCESSOR_H */
  175.